<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cetak OR</title>
<?php $this->load->helper('HTML');
echo link_tag('css/style2.css');
echo link_tag('images/favicon.ico','shortcut icon','image/x-icon');
?>
</head>
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=print_or_dealer.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<body>
<table width="800" align="center" class="detail">
	<tr class="detail2">
   	  <td align="center">
        <table width="800" align="center" class="detail">
        <tr class="detail2">
          <td width="440" rowspan="4" valign="top"><img src="<?php echo base_url();?>images/logo.jpg" />&nbsp;</td>
          <td width="41">&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td width="41">&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td colspan="3" >LAPORAN OVERIDING <?php echo strtoupper($nama_dealer->strnama_dealer) ?> &nbsp;&nbsp;&nbsp;PENJUALAN PRIBADI 				<?php  if ((!empty($data_omset[0]->omset10)) or (!empty($data_omset[0]->omset20))){
	   $omset = ($data_omset[0]->omset10) + ($data_omset[0]->omset20);
	   } else {$omset = 0;}
		echo "Rp. ".number_format($omset,2 , ',' , '.');?></td>
          </tr>
        <tr >
            <td colspan="2"class="detail2">PERIODE : <?php echo strtoupper($nama_bulan) ?></td>
                <td>&nbsp;</td>
        </tr>
            
            <tr >
            <td colspan="2"class="detail2">CABANG : <?php echo strtoupper($data_pv_dealer[0]->strnama_cabang)?></td>
                <td>&nbsp;</td>
        </tr>
    </table>    </td>
    <tr>
    	<td align="center">
        	<table width="800" border="1" align="center"  class="detail">
			<tr class="detail2">
                	<th width="50">NO</th>
                    <th width="89">DOWNLINE</th>
                    <th width="113">PENJUALAN 10%</th>
                    <th width="113">PENJUALAN 20%</th>
                    <th width="38">DISC</th>
                    <th width="95">HARGA DEALER</th>
                    <th width="26">OR</th>
                    <th width="35">(Pph)</th>
                    <th width="65">TERIMA</th>
                    <th width="112">KETERANGAN</th>
			</tr> <tr>
                	<td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <?php
                $total = 0;
                $no=1;
                $tot10=0;
                $tot20=0;
                $har=0;
                $over=0;
                $cash=0;
                $diskon=0;
                $tpph=0;
				$tterima=0;
                foreach($data_pv_dealer as  $d):
                $dd = $d->intkomisi10 + $d->intkomisi20;
				$t20 = $d->intomset20 - ($d->intomset20 * 20 / 100);
				$t10 = $d->intomset10 - ($d->intomset10 * 10 / 100);
				$tot = $t20 + $t10;
				?>                <tr>
                    <td align="center"><?php echo $no?></td>
                    <td align="left"><?php echo $d->strnama_dealer?></td>
                    <td align="center"><?php echo "Rp. ".number_format($d->intomset10,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($d->intomset20,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($dd,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($tot,2 , ',' , '.');
					//echo $tot;
					?></td>
                    <td align="center"><?php 
						//line ikhlas 19042013
						//echo "Rp. ".number_format((($d->inttotal_bayar * 3 )/ 100),2 , ',' , '.');
						echo "Rp. ".number_format((($tot * 3 )/ 100),2 , ',' , '.');
						?></td>
                    <td align="center"><?php
						//line ikhlas 19042013
						//$or = ($d->inttotal_bayar * 3 )/ 100; $pph = ( $or* 5)/100; echo "Rp. ".number_format($pph,2 , ',' , '.');
						$or = ($tot * 3 )/ 100; 
						$pph = ( $or* 5)/100; 
						echo "Rp. ".number_format($pph,2 , ',' , '.');
						?></td>
                    <td align="center"><?php $terima = $or - $pph; echo "Rp. ".number_format($terima,2 , ',' , '.');?></td>
                    <td align="center"><?php echo ''?></td>
                </tr>
                <?php $no++; 
					$tot10 = $tot10 + $d->intomset10;
                    $tot20 = $tot20 + $d->intomset20;
                    $har = $har + $tot;
                    //$over = $over + ($d->inttotal_bayar * 3 )/ 100;
                    $over = $over + ($tot * 3 )/ 100;
                    $cash = $cash + $d->intcash;
                    $diskon = $diskon + ($dd);
					//$or = ($d->inttotal_bayar * 3 )/ 100; 
					$or = ($tot * 3 )/ 100; 
					$pph = ( $or* 5)/100;
					$tpph= $tpph + $pph;
					$terima = $or - $pph;
					$tterima = $tterima + $terima;
				endforeach;?>

                <tr>
                	<td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                	<td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
               
                <tr class="detail">
                	<td  align="center">&nbsp;</td>
                    <td align="center">TOTAL</td>
                  <td align="center"><?php echo "Rp. ".number_format($tot10,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($tot20,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($diskon,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($har,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($over,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($tpph,2 , ',' , '.');?></td>
                    <td align="center"><?php echo "Rp. ".number_format($tterima,2 , ',' , '.');?></td>
                    <td align="center">&nbsp;</td>
                </tr>
      </table>      </td>
    </tr>
                <tr>
                	<td align="center"><table width="800" align="center" class="detail">
                        <tr class="detail2">
                          <td width="229" colspan="4" align="center">DIBUAT OLEH</td>
                          <td width="229" colspan="4" align="center">DIPERIKSA OLEH</td>
                          <td width="229" colspan="4" align="center">DITERIMA OLEH</td>
                        </tr>
                        <tr>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                        </tr>
                        <tr>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                          <td width="229" colspan="4" align="right">&nbsp;</td>
                        </tr>
                        <tr>
                          <td width="230" colspan="4" align="center">(....................)</td>
                          <td width="230" colspan="4" align="center">(....................)</td>
                          <td width="230" colspan="4" align="center">(....................)</td>
                        </tr>
                      </table></td>
  </tr>
</table>
</body>
</html>